/*
 * ecx_err.c
 * cezanne@clunix,com, 2005.12
 *
 * Copyright (c) 2001-2008 by Clunix Inc. All Rights Reserved.
 */

#include "config.h"

#include "edbd.h"
#include "edbd_ecx.h"

void
push_verror(ecx_info_t *ecx_info, ecx_err_t err, const char *fmt, va_list ap)
{
	sr_t	*sr_errmsg;
	char	*errmsg;

#if !defined(ECM_DEBUG)
	if (err != -ERR_ECX_UICLASS || ecx_info->err == -ERR_ECX_UICLASS)
		return;
#endif
	ecx_info->err = err;
	ecm_vasprintf(&errmsg, fmt, ap);
	sr_errmsg = sr_set_val(sr_create(ST_STR), sr_val_str(errmsg));
	sr_append(ecx_info->sr_errmsgs, sr_errmsg);
}

void
push_error(ecx_info_t *ecx_info, ecx_err_t err, const char *fmt, ...)
{
	va_list	ap;

	va_start(ap, fmt);
	push_verror(ecx_info, err, fmt, ap);
	va_end(ap);
}
